{% extends "base.html" %}
{% block title %}Monthly View{% endblock %}
{% block main_content %}
    <h3>Monthly View</h3>
    <h4>
        <a href="{% url swingtime-monthly-view last_month.year last_month.month %}" 
           title="Last Month">&larr;</a>
        {{ this_month|date:"F" }}
        <a title="View {{ this_month.year}}" href="{% url swingtime-yearly-view this_month.year %}">
            {{ this_month|date:"Y" }}</a>
        <a href="{% url swingtime-monthly-view next_month.year next_month.month %}" 
           title="Next Month">&rarr;</a>
    </h4>

    <table class="month-view">
        <thead>
            <tr>
                <th>Sun</th><th>Mon</th><th>Tue</th><th>Wed</th><th>Thu</th><th>Fri</th><th>Sat</th>
            </tr>
        </thead>
        <tbody>
            {% for row in calendar %}
            <tr>
                {% for day,items in row  %}
                <td{% ifequal day today.day  %} class="today"{% endifequal %}>
                {% if day %}
                    <div class="day-ordinal">
                        <a href="{% url swingtime-daily-view today.year today.month day %}">{{ day }}</a>
                    </div>
                    {% if items %}
                    <ul>
                        {% for item in items %}
                        <li>
                            <a href="{{ item.get_absolute_url }}">
                                {{ item.title }}</a>
                            <span class="event_times">{{ item.start_time|time }}</span>
                        </li>
                        {% endfor %}
                    </ul>
                    {% endif %}
                {% endif %}
                </td>
                {% endfor %}
            </tr>
            {% endfor %}
        </tbody>
    </table>
{% endblock %}